package com.wc.codeforces.二分.Alice_s_Adventures_in_Permuting;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/11/11 11:04
 * @description https://codeforces.com/contest/2028/problem/B
 */
public class Main {
    /**
     * 思路：模拟就好了, 特殊情况 c >= n, 所有数都 > n - 1, 那就是 n 次修改
     * b == 0, 所有数都一样, c >= n, 同上
     * c >= n - 2, 有一个数在里面, res = n - 1
     * 否则就形成不了
     * 最后就是, 所有数都不一样, 并且有数在 n - 1 之内的, 就用二分查找有多少个数在里面
     * 数据范围  b * (x - 1) + c <= n - 1, 但是 b * (x - 1) 会越界, 改用除法
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static long n, b, c;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextLong();
            b = sc.nextLong();
            c = sc.nextLong();
            if (b == 0) {
                if (c >= n) out.println(n);
                else if (c >= n - 2) out.println(n - 1);
                else out.println(-1);
            } else if (c >= n) {
                out.println(n);
            } else {
                long l = 1, r = n;
                while (l < r) {
                    long mid = l + r + 1 >> 1;
                    if ((mid - 1) <= (n - 1 - c) / b) l = mid;
                    else r = mid - 1;
                }
                out.println(n - l);
            }
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}

